package com.shop.controller;

import com.shop.pojo.ItemsParam;
import com.shop.service.ItemsParamService;
import com.shop.vo.ItemsParamSaveRequest;
import com.shop.vo.ItemsParamUpdateRequest;
import com.shop.vo.JSONResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * 商品参数 
 *
 * @author yukangkang
 * @email sunlightcs@gmail.com
 * @date 2020-10-30 13:16:29
 */
@RestController
@RequestMapping("items-param")
public class ItemsParamController {

    @Autowired
    private ItemsParamService itemsParamService;



    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    @ApiOperation(value = "详情")
    public JSONResponse info(@PathVariable("id") String id){
		ItemsParam itemsParam = itemsParamService.getById(id);
        return JSONResponse.ok(itemsParam);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation(value = "保存")
    public JSONResponse save(@RequestBody ItemsParamSaveRequest request){
		itemsParamService.save(request);
        return JSONResponse.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @ApiOperation(value = "修改")
    public JSONResponse update(@RequestBody ItemsParamUpdateRequest request){
		itemsParamService.update(request);
        return JSONResponse.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除")
    public JSONResponse delete(@PathVariable String id){
		itemsParamService.delete(id);
        return JSONResponse.ok();
    }

}
